package com.btjava.maven.pomver.action;

import com.btjava.maven.pomver.data.CommonData;
import com.btjava.maven.pomver.handler.DataHandler;
import com.btjava.maven.pomver.handler.PomXmlHandler;
import com.btjava.maven.pomver.window.MavenDiaLog;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.vfs.VirtualFile;

import java.io.File;

public class PomverAction extends AnAction {

    @Override
    public void actionPerformed(AnActionEvent e) {
        //获取workSpace.xml文件路径
        VirtualFile workspaceFile = e.getProject().getWorkspaceFile();
        CommonData.project = e.getProject();
        CommonData.workSpacePath = workspaceFile.getPath();
        DataHandler.getRepositoryUrl();
        VirtualFile baseFile = e.getProject().getBaseDir();
        CommonData.pomPath = baseFile.getPath()+ File.separator+"pom.xml";
        CommonData.artifactId =PomXmlHandler.getArtifactId(CommonData.pomPath);
        MavenDiaLog diaLog = new MavenDiaLog();
        diaLog.show();
    }
}
